// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init()

const db = cloud.database()
exports.main = async (event, context) => {
  try {
    return await db.collection('todos').where({index:event.index}).update({
      // data 传入需要局部更新的数据
      data: {
        // 表示将 done 字段置为 true
        index:event.index,
        name: event.name,
        rolename: event.rolename,
        sex: event.sex,
        money: event.money,
        str: event.str,
        con: event.con,
        siz: event.siz,
        dex: event.dex,
        app: event.app,
        int: event.int,
        pow: event.pow,
        edu: event.edu,
        summary: event.summary,
        HP:event.HP,
        ch:event.ch,
        zt:event.zt,
        ability:event.ability,

      }
    })
  } catch(e) {
    console.error(e)
  }
}
